package blip.jcaf.cm;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.Socket;

public class EntryMonitorTestClient {
	public static void main(String[] args) {
		try { // args: server hostname, port, message !
//			Socket con = new Socket(args[0], Integer.parseInt(args[1]));
			System.out.println("trying to connect ...");
			Socket con = new Socket("10.25.240.153", 12345);
			System.out.println("connected!");
			PrintStream out = new PrintStream(con.getOutputStream());
//			out.print(args[2]);
			out.print("This is a test message!");
			out.write(0); // recall we used '0' as end marker
			out.flush();
			InputStreamReader in = new InputStreamReader(con.getInputStream());
			int c;
			while ((c = in.read()) != -1)
				System.out.print((char) c);
			con.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}